using DslFactory.Utilities.DteCodeModel;
using EnvDTE;

namespace Dslfactory.wcfLanguage
{
 public partial class TypeOfInterest
 {
  public TypeOfInterest ShowIfPossible(string typeFullName)
  {
   KnownCodeTypes knownCodeTypes = KnownCodeTypes.FromStore(Store);
   if (knownCodeTypes == null)
    return null;
   CodeType codeType = knownCodeTypes.GetFullNamedType(typeFullName);
   if (codeType == null)
   {
    CodeType[] namedTypes = knownCodeTypes.GetNamedTypes(typeFullName);
    if (namedTypes.Length == 1)
     codeType = namedTypes[0];
   }
   if (codeType == null)
    return null;
   if (ReverseEngineering.CanBeMerged(codeType))
    return ReverseEngineering.Merge(GetServicesDefinition(), codeType);
   else
    return null;
  }
 }
}
